package com.fengkai.filepost.pdfoutstream.test.my;

import org.aspectj.weaver.ast.Var;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author Fengkai
 * @creat 2023/5/5
 */
public class Shifei {

    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] s1 = s.split(" ");

        int m = Integer.parseInt(s1[0]);
        int n = Integer.parseInt(s1[1]);
        int[] fields = new int[m];
        for (int i = 0; i < m; i++) {
            fields[i] =  scanner.nextInt();
        }
        if (n < m) {
            System.out.println("-1");
            return;
        }
        int k = getKValue(fields, n);
        System.out.println(k);
    }

    //贪心
    private static int getKValue (int[] ints, int n) {
        int length = ints.length;
        int k = 0;
        Arrays.sort(ints);
        int min = 0;
        int max = ints[length - 1];
        while (min + 1 < max) {
            int mid = (int) Math.ceil((double) (min + max) / 2);
            int sum = 0;
            for (int i = 0; i < length; i++) {
                sum += (int) Math.ceil((ints[i] / (double) mid));
            }
            if (sum > n) {
                min = mid;
            } else {
                k = mid;
                max = mid;
            }
        }
        return k;
    }
}
